#include <stdio.h>
#include <sys/types.h>          /* See NOTES */
#include <sys/socket.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdlib.h>

int main(int argc, const char *argv[])
{
	int sockfd=socket(AF_INET,SOCK_DGRAM,0)	;
	struct sockaddr_in serveraddr;
	socklen_t addrlen=sizeof(serveraddr);
    serveraddr.sin_family = AF_INET;
    serveraddr.sin_addr.s_addr = inet_addr(argv[1]);
    serveraddr.sin_port = htons(atoi(argv[2]));
//	bind(sockfd,(struct sockaddr *)&serveraddr,addrlen);

	char sndbuf[128];
	while(1)
	{
		scanf("%s",sndbuf);
		sendto(sockfd,sndbuf,128,0,(struct sockaddr *)&serveraddr,addrlen);
		memset(sndbuf,0,128);
	}
	return 0;
}
